﻿using System;
using System.Diagnostics;
using Smarly.Idml.RelaxNg.Generator.Model;
using Tenuto.Grammar;

namespace Smarly.Idml.RelaxNg.Generator.Proxy
{
	public class ElementExpBuilder : Builder<ElementExp>
	{
		[DebuggerStepThrough]
		protected internal ElementExpBuilder(ElementExp exp, Action<IObjectName> updateName) : base(exp, updateName) { }

		public override IStruct CreateIStruct()
		{
			ObjectStruct objectStruct = new ObjectStruct()
				                            {
					                            ObjectName = ((SimpleNameClass) Exp.Name).name.local,
				                            };

			Factory(Exp.exp, UpdateName).Fill(objectStruct);

			return objectStruct;
		}

		public override IStruct Fill(IStruct getStruct)
		{
			getStruct = base.Fill(getStruct);

			//todo uncoment
			return getStruct;
			throw new NotImplementedException();
		}
	}
}